<template>
  <div>
    <div class="hello cf wp1080 detail">
      <div  class="cf">
        <el-col :span="24">
          <rootPath-view :child-msg="current"></rootPath-view>
        </el-col>
      </div>
      <div class="bgfff cf">
        <el-col :span="24" class="cf">
          <el-col :span="18" class="detail-box">
            <div>
              <img :src="dataList.imgUrlIcon" alt="" style="width: 140px;height: 140px;" class="mr20">
            </div>
            <div>
              <div>
                <span class="detail-name">{{dataList.name}}</span>
                <span class="detail-ename">ARK:Survival Evolved</span>
              </div>
              <div style="display: flex;flex-direction: row;">
                <span class="detail-tips">官方版</span>
                <span class="detail-tips">安全</span>
                <span class="detail-tips">无广告</span>
              </div>
              <div class="detail-info">
                <el-col :span="24" class="cf">
                  <el-col :span="12" class="cf">版本：{{dataList.version}}</el-col>
                  <el-col :span="12" class="cf">类型：{{dataList.gameType}}</el-col>
                  <el-col :span="12" class="cf">语言：中文</el-col>
                  <el-col :span="12" class="cf">更新：</el-col>
                  <el-col :span="12" class="cf">大小：1.23</el-col>
                  <el-col :span="12" class="cf">作者：{{dataList.developer}}</el-col>
                </el-col>
              </div>
              <div class="cf lablebox">
                <el-col :span="24" class="cf">
                  <span>标签：</span>
                  <span>装扮精选</span>
                  <span>动漫</span>
                  <span>恋爱</span>
                  <span>养成</span>
                  <span>迷你游戏</span>
                </el-col>
              </div>
              <div class="cf">
                <el-col :span="24" class="cf" style="margin: 20px 0;">
                  <el-button type="primary" class="bggreen">
                    <a :href="dataList.downloadUrl" :download="dataList.name">
                      用APP下载
                    </a>
                  </el-button>
                  <el-button type="primary" class="bgorange">
                    <a :href="dataList.downloadUrl" :download="dataList.name">
                      安装包下载
                    </a>
                  </el-button>
                </el-col>
              </div>
            </div>
          </el-col>
          <!--<el-col :span="6">-->
          <div class="detail-ma">
            <div>
              <img src="../../static/img/erweima.png" alt="">
            </div>
            <p>扫描二维码下载</p>
          </div>
          <!--</el-col>-->
        </el-col>
        <div class="alter">
          <P>修改了什么？/温馨提示</P>
          <P>修改了无限钻石，钻石花费不减反增</P>
        </div>
        <el-col :span="24" class="carousel">
          <ul class="img-box">
            <li v-for="(item, index) in imglist"><img :src="item" alt=""  :key="index" class="img-h"></li>
          </ul>
        </el-col>
        <el-col :span="24" class="cf margin-top">
          <el-col :span="16" class="cf">
            <div class="left-border">
              <div class="right-title">游戏简介</div>
              <div class="text-left" v-html="dataList.introduce">
                <!--Wildcard工作室宣布旗下生存游戏《方舟:生存进化》将于今年春季登陆iOS/安卓平台，游戏本体将提供免费下载。
                本作手机版将新加入“琥珀”道具，包含角色快速升级、获得短期增益效果、增设特殊建筑、回复濒死宠物等不同功能。
                游戏故事主要讲述，一群人醒来便出现在神秘海滩，为了生存而探索远古开放世界，玩家需要通过合作/竞技来获取生活必需品。人类需要打猎、收获、研究技术，甚至要根据动态天气变化搭建住处，而危险的远古动物会随机出现威胁人类生存。-->
              </div>
            </div>
            <div class="left-border">
              <div class="right-title">更新内容</div>
              <div class="text-left">
                1.调整第一章关卡难度和地图；
                2.限时推出大转盘免费抽奖，航拍飞行器实物大放送；
                3.增强新手飞车的属性，加速提升；
                4.修正冰雪地图的贴图错误。
              </div>
            </div>
            <div class="left-border">
              <div class="right-title">充值福利</div>
              <div class="text-left">
                单日累计充值100~499元，可获得50%返利
                单日累计充值500~999元，可获得75%返利
                单日累计充值1000~2999元，可获得100%返利
                单日累计充值3000~4999元，可获得130%返利
              </div>
            </div>
            <div class="left-border">
              <div class="right-title">相关游戏推荐</div>
              <ul class="hotList">
                <li :span="4" v-if="index<5" v-for="(piece, index) in list.recommend" :key="index">
                  <img :src="piece.imgUrlIcon" alt="" class="piece-icon cursor" @click="toDetail(piece.id)">
                  <P class="cursor" @click="toDetail(piece.id)">{{piece.name}}</P>
                </li>
              </ul>
            </div>
            <el-col :span="24" class="">
              <div class="cf ">
                <span class="fl font20 col-73">{{dataList.name}}</span>
                <span class="fr colGreen">已有520人发表评论</span>
              </div>
            </el-col>
            <el-col :span="24"  >
              <div class="buildBox">
                <button class="buildBtn">安装游戏虫APP进行讨论</button>
              </div>
              <ul class="list-ul">
                <li  class="comment-li" v-for="(item,index) in dataList.commentList" :key="index">
                  <div class="cf">
                    <img :src="item.imgUrlIcon" alt="" class="fl">
                    <div class="fl">
                      <span class="col666 comment-li-name">{{ item.name }}</span>
                      <div>
                        <el-rate class=""
                                 v-model="item.gameScore"
                                 disabled
                                 show-score
                                 text-color="#ff9900"
                                 score-template="{value}">
                        </el-rate>
                      </div>
                    </div>
                    <div class="fr col-a0a0a0 comment-li-date">{{ item.date }}</div>
                  </div>
                  <div class="comment-li-comment">
                    {{ item.comment }}
                  </div>
                </li>
              </ul>
            </el-col>
          </el-col>
          <el-col :span="7" :offset="1" class="cf right-content">
            <div class="right-border" style="height: 320px;overflow: hidden;box-sizing: border-box;">
              <div class="right-title">此游戏其他版本</div>
              <el-col :span="24" v-if="index < 3" v-for="(item, index) in list.allplay" :key="item.id">
                <introduceList-view @toDetail="toDetail" :child-msg="item"></introduceList-view>
              </el-col>
            </div>
            <div class="right-border" style="height: 600px;overflow: hidden;box-sizing: border-box;">
              <div class="right-title">热门推荐</div>
              <el-col :span="24" class="cf" v-if="index < 6" v-for="(item, index) in list.recommend" :key="item.id">
                <introduceList-view @toDetail="toDetail" :child-msg="item"></introduceList-view>
              </el-col>
            </div>
          </el-col>
        </el-col>

      </div>
    </div>
    <easyfooter></easyfooter>
  </div>
</template>

<script>
import introduceList from '../components/introduceList.vue'
import rootPath from '../components/rootPath.vue'
import myCarsos from '../components/carsoul.vue'
import leftList from '../components/leftList.vue'
// import { Loading } from 'element-ui'
import easyfooter from '../components/easy-footer.vue'

export default {
  name: 'detail',
  components: {
    'leftList-view': leftList,
    'introduceList-view': introduceList,
    'rootPath-view': rootPath,
    'carsoul-view': myCarsos,
    'easyfooter': easyfooter
  },
  data () {
    return {
      current: '详情',
      imglist: [],
      list: [],
      dataList: {
        commentList: [
          // {
          //   id: '14242',
          //   name: '苏慕路',
          //   date: '2018-05-08',
          //   imgUrlIcon: '/static/img/left.png',
          //   gameScore: '5',
          //   comment: '这是评论这是评论这是评论这是评论这是评论这是评论这是评论'
          // },
          // {
          //   id: '14242',
          //   name: '苏慕路',
          //   date: '2018-05-08',
          //   imgUrlIcon: '/static/img/left.png',
          //   gameScore: '5',
          //   comment: '这是评论这是评论这是评论这是评论这是评论这是评论这是评论'
          // }
        ]
      }
    }
  },
  methods: {
    toDetail (id) {
      console.log(id)
      let detailAPI = '/game/details/' + id
      this.$router.push({path: '/detail', query: {userId: id}})
      let that = this
      // 此地有传auth(token)认证 为空就不会执行
      this.$request.get(detailAPI, false,
        function (res) {
          if (res.data.code === 1000) {
            that.dataList = res.data.rst
            console.log(that.dataList)
            that.imglist = that.dataList.imgUrlBig.split('|')
          }
        }
      )
    }
  },
  created () {
    // let loadingInstance = Loading.service({fullscreen: true, spinner: 'el-icon-loading', background: 'rgba(255,255,255, 0.8)'})
    let detailAPI = '/game/details/' + this.$route.query.userId
    let that = this
    console.log(this.$route.query.userId)
    // 此地有传auth(token)认证 为空就不会执行
    this.$request.get(detailAPI, false,
      function (res) {
        if (res.data.code === 1000) {
          // loadingInstance.close()
          that.dataList = res.data.rst
          // console.log(that.dataList)
          that.imglist = that.dataList.imgUrlBig.split('|')
          // console.log(that.dataList.commentList)
        }
      }
    )
    let homeAPI = 'pc/pchome'
    this.$request.get(homeAPI, false,
      function (res) {
        if (res.data.code === 1000) {
          that.list = res.data.rst
          console.log(that.list)
        }
      }
    )
  },
  mounted: function () {}
}
</script>
<style scoped>
  .detail-box{
    display: flex;
    flex-direction: row;
    line-height: 30px;
  }
  .right-title{
    font-weight: bold;
  }
  .detail-name{
    color: rgba(115, 115, 115, 1);
    font-size: 20px;
    font-weight: bold;
    text-align: left;
    font-family: Roboto;
  }
  .detail-ename{
    color: rgba(115, 115, 115, 1);
    font-size: 16px;
    text-align: left;
    font-family: Roboto;
  }
  .detail-tips{
    color: rgba(0, 150, 136, 1);
    font-size: 12px;
    text-align: center;
    font-family: Microsoft Yahei;
    border: 1px solid rgba(0, 150, 136, 1);
    line-height: 24px;
    box-sizing: border-box;
    padding: 0 5px;
    margin-right: 10px;
  }
  .detail-info{
    display: flex;
    flex-direction: row;
    color: #737373;
    font-size: 14px;
  }
  .detail-ma{
    /*display: flex;*/
    /*flex-direction: column;*/
    position:absolute;
    top:45px;
    right:70px;
    width:116px;
  }
  .detail-ma>p{
    margin-top: 12px;
    text-align:center;
  }
  .bgfff{
    background: #fff;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 0 3px 0 rgba(219,219,219,1);
    margin-bottom: 40px;
    position:relative;
  }
 .mr20{
   margin-right: 20px;
 }
 .right-content{
   padding-top: 20px;
 }
 .margin-top{
   margin-top:20px;
 }
  .lablebox span{
    display: inline-block;
    padding:0px 8px;
    height: 30px;
    border-radius: 2px;
    background-color: rgba(221, 221, 221, 1);
    color: rgba(115, 115, 115, 1);
    font-size: 14px;
    text-align: center;
    font-family: Microsoft Yahei;
  }
  .lablebox span:nth-child(1){
    background: none;
    padding:0;
  }
  .bggreen{
    background: #009688;
    border: none;
    font-size: 18px;
  }
  .bgorange{
    background: #FF9800;
    border: none;
    font-size: 18px;
  }
  .text-left{
    text-align: left;
  }
  .left-border{
    line-height: 26px;
  }
  .left-border{
    background-color: white;
    text-align: center;
    padding:0 18px 40px;
  }
  .buildBox{
    width: 100%;
    height: 80px;
    line-height: 80px;
    background: #f5f5f5;
    text-align: center;
    margin: 10px 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
  }
  .buildBtn{
    padding: 5px 20px;
    background: #009688;
    border: none;
    color: #fff;
    border-radius: 4px;
  }
  .font20{
    font-size: 20px;
  }
  .col-73{
    color:#737373;
  }
  .colGreen{
    color: #009688;
  }
  .list-ul li{
    border: 1px solid #d1d1d1;
    padding: 20px;
    margin-bottom: 20px;
  }
  .list-ul li .comment-li-comment{
    margin-top: 10px;
  }
  .list-ul li img{
    width: 40px;
    height: 40px;
    border-radius: 20px;
    margin-right: 10px;
  }
  .list-ul li .comment-li-name{
    margin-bottom: 5px;
    display: inline-block;
  }
  .list-ul li .comment-li-date{

  }
  .col666{
    color: #666;
  }
  .col-a0a0a0{
    color: #a0a0a0;
  }
  .bgorange a, .bggreen a{
    color: #ffffff;
  }
  .alter{
    float:left;
    width:100%;
    height:98px;
    border:1px solid #009688;
    margin-bottom:19px;
    background:rgba(0,150,136,0.12);
  }
.alter p:first-child{
  margin:18px auto auto 22px;
  font-size:20px;
  font-weight:bold;
  color:rgba(115,115,115,1);
}
  .alter p:last-child{
    margin:10px auto auto 22px;
    font-size:14px;
    height:26px;
    line-height:26px;
    color:rgba(115,115,115,1);
  }
  .hotList{
    margin-top: 20px;
    overflow:hidden;
  }
  .hotList .piece-icon{
    width:62%;
    height:auto;
  }
  .hotList li{
    float:left;
    width:20%;
    text-align:center;
  }
  .hotList li p{
    width:131px;
    overflow:hidden;
    margin-top: 10px;
    text-align:center;
    text-overflow:ellipsis;
    white-space: nowrap;
  }
  .cursor{
    cursor:pointer;
  }
  .carousel{
    position:relative;
    height:288px;
    overflow:hidden;
    white-space:nowrap;
  }
  .img-box{
    overflow-x: auto;
    height:288px;
    overflow-y:hidden;
    white-space: nowrap;
    font-size:0;
  }
  .img-box>li{
    display: inline-block;
    position: relative;
    height: 100%;
    padding-right: 20px;
    vertical-align: middle;
  }
  .img-box>li:last-child{
    padding-right:0px;
  }
  .img-box .img-h{
    height:100%;
    width:auto;
    font-size:0;
    white-space:nowrap;
  }
</style>
